
<nav class="mt-2">
    <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">

        @foreach($menus as $menu)
            @can($menu->name)
                <li class="nav-item">
                    <a href="#" class="nav-link first">
                        <i class="nav-icon fas fa-tachometer-alt"></i>
                        <p>
                            {{$menu->display_name}}
                            <i class="right fas fa-angle-left"></i>
                        </p>
                    </a>

                    @if($menu->child->isNotEmpty())
                        <ul class="nav nav-treeview">
                            @foreach($menu->child as $child)
                                @can($child->name)
                                <li class="nav-item">
                                    <a href="{{route($child->route)}}" class="nav-link subLink  {{strpos(route($child->route),$_SERVER['REQUEST_URI']) !== false && $_SERVER['REQUEST_URI'] !== '/admin' ?'active':''  }}">
                                        <i class="far fa-circle nav-icon"></i>
                                        <p>{{$child->display_name}}</p>
                                    </a>
                                </li>
                                @endcan
                            @endforeach
                        </ul>
                    @endif
                </li>
            @endcan
        @endforeach
    </ul>
</nav>